home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / mail / thor201.lha / THOR_2.0 / UpdateThor < prev    next >
Text File  |  1995-05-15  |  15KB  |  568 lines

  1. ;*************************************************************************
  2. ;    Title:
  3. ;        UpdateThor
  4. ;*************************************************************************
  5. ;    Description:
  6. ;        Commodore Installer Script for the Thor 2.0 software
  7. ;*************************************************************************
  8. ;    Author:
  9. ;        Øyvind Ellefsen - versions for THOR upto 1.22
  10. ;       Petter Nilsen   - versions for 1.25 ->
  11. ;*************************************************************************
  12. ;    Still to do:
  13. ;        - THOR.macros might not be correct. Notify user?
  14. ;        - Handle previous installations with one of the env-vars/assigns
  15. ;          missing.
  16. ;        - Show .readme file
  17. ;        - Check in libs:,l: too for libraries.
  18. ;       - Not delete catalogs/, only the needed dirs
  19. ;
  20. ;*************************************************************************
  21. ;
  22. ;******************************************************
  23. ;***** SET UP OUR VARIABLES AND OTHER SUCH STUFF ******
  24. ;******************************************************
  25.  
  26. ; some useful variables
  27.     (set true 1)
  28.     (set false 0)
  29.     (set yes true)
  30.     (set no false)
  31.     (set is_a_file 1)
  32.     (set is_a_dir 2)
  33.     (set quote "\"")
  34.     (set newline "\n")
  35.     (set nothing "")
  36.     (set V3_Update no)
  37.  
  38. ; set up our delete options
  39.     (delopts "AskUser" "OkNoDelete" "Force")
  40.  
  41. ; some useful procedures
  42.     ; change userlevel to expert
  43.     (procedure expert_level
  44.         (
  45.             (user 2)
  46.         )
  47.     )
  48.  
  49. ; reset userlevel back to default
  50.     (procedure default_level
  51.         (
  52.             (user default-level)
  53.         )
  54.     )
  55.  
  56. ; store off userlevel
  57.     (procedure save_default_level
  58.         (
  59.             (set default-level @user-level)
  60.         )
  61.     )
  62.  
  63. ; some overused strings
  64. (set omp (cat "One moment please..." newline))
  65.  
  66.  
  67. ; introduce ourselfs to the viewers
  68. (welcome "Welcome to the Thor installer.  This installer uses "
  69.     "the Commodore Amiga Installer.  All of our future Thor releases "
  70.     "will be using this installer and we would like to get any feedback "
  71.     "that might help to improve the installation procedure." newline
  72. )
  73.  
  74.  
  75. ; first reset the user level so that the novice can see whats going on
  76.     (save_default_level)
  77.     (expert_level)
  78.  
  79. ;Make assign to install from
  80.     (makeassign "Thor_Install" "" (safe))
  81.  
  82.  
  83. ;******************
  84. ;** Check Memory **
  85. ;******************
  86.  
  87. (run "Avail flush")
  88.  
  89. (set Running (run "Thor_Install:CheckForLib"))
  90.  
  91. (while (= Running 20)
  92.       ((Message newline "Thor seem to be running, you MUST close it NOW."    
  93.         newline "If you don't, the installation will fail!")
  94.     (run "Avail flush")
  95.     (set Running (run "Thor_Install:CheckForLib")))
  96. )
  97.  
  98. ;************************
  99. ;** Start Installation **
  100. ;************************
  101.  
  102. (if (exists "ENV:THOR/THORPath" (noreq))
  103. (
  104.     (if (set Thor_Dir (getenv "THOR/THORPath"))
  105.     (
  106.         (set Thor_Dir (substr Thor_Dir 0 (- (strlen Thor_Dir) 1)))
  107.         (set Thor_Dir (expandpath Thor_Dir))
  108.         (set V3_Update yes)
  109.         (makeassign "Thor" Thor_Dir (safe))
  110.     )
  111.     ; Else
  112.     (
  113.         (if (exists "Thor:libs/bbsread.library" (noreq))
  114.             ; Then
  115.             (    
  116.                 (set Thor_Dir (expandpath "Thor:"))
  117.             )
  118.             ; Else
  119.             (
  120.                 (set end_text "Please use the InstallThor script for a first-time installation.")
  121.                 (abort end_text))
  122.             )
  123.         )
  124.     )
  125. )
  126. ; Else
  127. (
  128.     (if (exists "Thor:libs/bbsread.library" (noreq))
  129.         ; Then
  130.         (    
  131.             (set Thor_Dir (expandpath "Thor:"))
  132.         )
  133.         ; Else
  134.         (
  135.             (set end_text "Please use the InstallThor script for a first-time installation.")
  136.             (abort end_text))
  137.         )
  138.     )
  139. )
  140.  
  141. (if (exists "ENV:THOR/THORPath" (noreq))
  142. (
  143.     (if (set BBSData_Dir (getenv "THOR/BBSDataPath"))
  144.     (
  145.         (set BBSData_Dir (substr BBSData_Dir 0 (- (strlen BBSData_Dir) 1)))
  146.         (set BBSData_Dir (expandpath BBSData_Dir))
  147.         (set V3_Update yes)
  148.         (makeassign "BBSData" BBSData_Dir (safe))
  149.     )
  150.     ; Else
  151.     (
  152.         (if (exists "BBSData:global.config" (noreq))
  153.             ; Then
  154.             (
  155.                 (set BBSData_Dir (expandpath "BBSData:"))
  156.             )
  157.             ; Else
  158.             (
  159.                 (set end_text "Please use the InstallThor script for a first-time installation.")
  160.                 (abort end_text))
  161.             )
  162.         )
  163.     )
  164. )
  165. ; Else
  166. (
  167.     (if (exists "BBSData:global.config" (noreq))
  168.         ; Then
  169.         (
  170.             (set BBSData_Dir (expandpath "BBSData:"))
  171.         )
  172.         ; Else
  173.         (
  174.             (set end_text "Please use the InstallThor script for a first-time installation.")
  175.             (abort end_text))
  176.         )
  177.     )
  178. )
  179.  
  180. ;**********************************************
  181. ;** Hostile deletion of old files here.. ******
  182. ;**********************************************
  183.  
  184. (if (= V3_Update no)
  185.     (
  186.         (if (askbool
  187.                 (prompt "Several old files left over from the the THOR 1.x" newline
  188.                     "releases are now obsolete and should be deleted." newline
  189.                     "This applies to the following directories: " newline
  190.                     "THOR:bin, THOR:s, THOR:rexx, THOR:libs and THOR:Scripts. " newline
  191.                     "If you have made any ARexx-scripts for Thor 1.xx,\n"
  192.                     "they might not work anymore. Check out the new\n"
  193.                     "ARexx-documentation and change your scripts accordingly.\n\n"
  194.                     "You might want to make a backup of personal files " newline
  195.                     "before proceeding." newline
  196.                     "Press 'Yes' to continue with deletion of obsolete files")
  197.                 (help
  198.                     "The installer has determined that you may already have a " 
  199.                     "copy of Thor installed on your system. "
  200.                     "Several files have changed and should be deleted since they "
  201.                     "will not function correctly with this release of THOR. "
  202.                 )
  203.                 (default 1)
  204.             )
  205.             ; Then
  206.             ( 
  207.                 (run "Delete THOR:ThorStat#?")
  208.                 (run "Delete THOR:THOR.history")
  209.                 (run "Delete THOR:libs/#?")
  210.                 (run "Delete THOR:bin/#?")
  211.                 (run "Delete THOR:s/#?")
  212.                 (run "Delete THOR:rexx/~(postinglists)")
  213.                 (run "Delete THOR:Scripts/#?")
  214.                 (run "Delete THOR:#?guide#?")
  215.                 (run "Delete THOR:THOR")
  216.                 (run "Rename THOR:THOR.info THOR:THOR.old.info")
  217.                 (run "Delete THOR:THOR.info")
  218.                 (run "Delete libs:bbsread.library")
  219.             )
  220.         )
  221.     )
  222. )
  223. ; Else
  224. (
  225.     (if (askbool
  226.             (prompt
  227.                 "Due to a problem with MultiUser filesystem, "
  228.                 "old files must be deleted before installing "
  229.                 "the new files. This is not needed if you do not "
  230.                 "run this filesystem on the partition THOR is "
  231.                 "installed on. Please take a backup of any personal ARexx "
  232.                 "scripts you might have made before selecting 'Yes' here.\n\n"
  233.                 "Press 'Yes' to continue with deletion of old files.")
  234.             (help
  235.                 "The installer has determined that you may already have a " 
  236.                 "copy of Thor installed on your system. "
  237.                 "Old files from a previous installation must be deleted "
  238.                 "if you are running the MultiUser filesystem on the "
  239.                 "partition THOR is installed on."
  240.             )
  241.             (default 1)
  242.         )
  243.         ; Then
  244.         ( 
  245.             (run "Delete THOR:ThorStat#?")
  246.             (run "Delete THOR:THOR.history")
  247.             (run "Delete THOR:libs/#?")
  248.             (run "Delete THOR:l/#?")
  249.             (run "Delete THOR:docs/#?")
  250.             (run "Delete THOR:bin/#?")
  251.             (run "Delete THOR:s/#?")
  252.             (run "Delete THOR:unix/#?")
  253.             (run "Delete THOR:rexx/~(postinglists) all")
  254.             (run "Delete THOR:Scripts/#?")
  255.             (run "Delete THOR:#?guide#?")
  256.             (run "Delete THOR:THOR")
  257.             (run "Rename THOR:THOR.info THOR:THOR.old.info")
  258.             (run "Delete THOR:THOR.info")
  259.             (run "Delete THOR:ConfigTHOR")
  260.             (run "Delete THOR:ConfigTHOR.info")
  261.             (run "Delete libs:bbsread.library")
  262.             (run "Delete libs:bbsreadcnv2.library")
  263.             (run "Delete l:bbsread-handler")
  264.             (run "Delete l:bbsreadrexx-handler")
  265.         )
  266.     )
  267. )
  268.  
  269. (run "Delete THOR:bin/initsoup")
  270. (run "Delete THOR:bin/configuucp")
  271.  
  272. ;******************
  273. ;** Locale stuff **
  274. ;******************
  275.  
  276. (default_level)
  277.  
  278.  
  279. (set name
  280.    (askoptions
  281.       (prompt "What languages would you like to install ?  English" newline
  282.             "is the built in language.")
  283.       (help
  284.             "This will install locale files for other languages than English. "
  285.             "You can set the prefered language on Workbench and in Thor by"
  286.             "using the prefs:locale tool." newline @askchoice-help
  287.       )
  288.       (choices "Norsk")
  289.       (default 0)
  290.    )
  291. )
  292.  
  293. ; Delete previous installed catalog files.
  294.  
  295. (if (= V3_Update yes)
  296.     (
  297.         (run "delete thor:catalogs all")
  298.     )
  299. )
  300.  
  301. (if (<> 0 name)
  302.    (makedir "thor:catalogs")
  303. )
  304.  
  305. (if (bitand 1 name)
  306.     (copyfiles
  307.         (source "Thor_Install:catalogs/norsk")
  308.         (dest "thor:catalogs/norsk")
  309.         (all)
  310. ))
  311.  
  312. ;***********************************
  313. ;***** GET FIRST DISK IN HERE ******
  314. ;***********************************
  315.  
  316. ; first copy over the stuff
  317. (working omp "Decompressing and copying Thor files.")
  318.  
  319. (run "Thor_Install:lhex -a -f -w=THOR: x Thor_Install:thor.lha" )
  320.  
  321. ;*********************
  322. ;** reqtools.libary **
  323. ;*********************
  324.  
  325. (copylib
  326.     (prompt "Copying ReqTools library")
  327.     (help "This will copy the ReqTools library." newline @copylib-help)
  328.     (source "Thor_Install:reqtools.library")
  329.     (dest "libs:")
  330. )
  331.  
  332. ;************************
  333. ;**  Copy the keyfile  **
  334. ;************************
  335. (if (exists "Thor_Install:THOR.key" (noreq))
  336. ; Then
  337.     (copyfiles
  338.         (source "Thor_Install:THOR.key")
  339.         (dest "THOR:")
  340.     )
  341. )
  342.         
  343. ;**********************************************
  344. ;* Convert the database to the new 2.0 format *
  345. ;**********************************************
  346.  
  347. (run "thor:bin/InitCharsets")
  348.  
  349. (default_level)
  350.  
  351. (if (= V3_Update no)
  352.     (
  353.         (message newline "The installer will now convert and upgrade the "
  354.         newline "message database to the new 2.0 format."
  355.         newline "This might take some time, so please be patient.")
  356.         (run "Avail flush")
  357.         (set Running (run "Thor:bin/basemanager convert >con:0/0/640/200/Converting/AUTO/CLOSE/WAIT"))
  358.         (if (<> 0 Running)
  359.         (
  360.             ((set end_text "Conversion of your old database failed." newline "Please take notice of the error message shown.")
  361.             (abort end_text)))
  362.         )
  363.     )
  364.     (run "thor:bin/initarc")
  365. )
  366.  
  367. (execute "thor:s/cfgqwk")
  368. (execute "thor:s/cfgfido")
  369. (execute "thor:s/cfgblue")
  370. (execute "thor:s/cfguqwk_soup")
  371. (execute "thor:s/cfguucp")
  372. (execute "thor:s/cfgsoup")
  373. (execute "thor:s/cfgabbs")
  374. (execute "thor:s/cfgabbs_qwk")
  375. (execute "thor:s/cfgmbbs")
  376. (execute "thor:s/cfgbbbs")
  377. (execute "thor:s/cfghippo")
  378. (execute "thor:s/cfgomen")
  379.  
  380. ;*********************************************
  381. ;** Copy configfiles from BBSDATA: to THOR: **
  382. ;*********************************************
  383.  
  384. (if (= V3_Update no)
  385.     (
  386.         (run "copy bbsdata:visual.config thor:visual.config")
  387.         (run "copy bbsdata:global.config thor:global.config")
  388.         (run "copy bbsdata:fse.config thor:fse.config")
  389.     )
  390. )
  391.  
  392. ;***********
  393. ;** Fonts **
  394. ;***********
  395.     
  396. (if (= V3_Update no)
  397.     (
  398.         (copyfiles
  399.             (prompt "Choose the fonts to install with Thor" newline "These are not required for Thor to run" )
  400.             (help "This will copy the default font files for Thor." newline @copyfiles-help)
  401.             (source "Thor_Install:Fonts")
  402.             (dest "Fonts:")
  403.             (fonts)
  404.             (choices "Grn" "Thin609" "Thin611" "Thin711")
  405.             (confirm)
  406.         )
  407.     )
  408. )
  409.  
  410. ;***************
  411. ;** LogReader **
  412. ;***************
  413.  
  414. ;(if    (askbool
  415. ;        (prompt newline "Do you want the LogReader software installed?")
  416. ;        (help newline "The LogReader software is a program for" newline
  417. ;             "calculating phone-bills from logfiles." newline
  418. ;            newline "Select YES if you want it installed, otherwise NO")
  419. ;        (default 1)
  420. ;    )
  421. ;    
  422. ;; Then
  423. ;    (copyfiles
  424. ;        (prompt "Copying LogReader files")
  425. ;        (help "This will copy the files needed by LogReader." newline @copyfiles-help)
  426. ;        (source "Thor_Install:LogReader")
  427. ;        (dest Thor_dir)
  428. ;        (all)
  429. ;        (infos)
  430. ;    )
  431. ;)
  432. ;
  433. ;****************
  434. ;** AmigaGuide **
  435. ;****************
  436.  
  437. (if (= V3_Update no)
  438.     (
  439.         (if    (askbool
  440.                 (prompt newline "Do you want the AmigaGuide" newline "program and library installed?"
  441.                     newline newline "If you have a newer version of the library" newline 
  442.                     "on your system, it will NOT be overwritten")
  443.                 (help newline "The AmigaGuide library is needed for the Thor documentation"
  444.                     newline "and the online help system in Thor."
  445.                     newline newline "Select YES if you want it installed, otherwise NO")
  446.                 (default 1)
  447.             )
  448.             ; Then
  449.             (
  450.                 (copyfiles
  451.                     (prompt "Copying AmigaGuide program file")
  452.                     (help "This will copy the files needed by AmigaGuide." newline @copyfiles-help)
  453.                     (source "Thor_Install:AmigaGuide")
  454.                     (dest "sys:Utilities")
  455.                 )
  456.                 (copylib
  457.                     (prompt "Copying AmigaGuide library")
  458.                     (help "This will copy the AmigaGuide library." newline @copylib-help)
  459.                     (source "Thor_Install:amigaguide.library")
  460.                     (dest "libs:")
  461.                 )
  462.             )
  463.         )
  464.     )
  465. )
  466.         
  467.  
  468. ;*****************************
  469. ;****** Install icons ********
  470. ;*****************************
  471.  
  472. (if    (askbool
  473.         (prompt newline "Do you want to install MagicWB " newline
  474.              "versions of the program and drawer icons?" newline)
  475.         (help newline "If you are using MagicWB on your Workbench, "
  476.             newline "you might want to install the special MagicWB icons."
  477.             newline newline "Select YES if you want it installed, otherwise NO")
  478.         (default 1)
  479.     )
  480. ; Then
  481.     (
  482.         (copyfiles
  483.             (prompt "Copying MagicWB icon files")
  484.             (source "Thor_Install:MWBIcons")
  485.             (dest "Thor:")
  486.             (pattern "~(THOR.guide.info)")
  487.             (nogauge)
  488.         )
  489.         (copyfiles
  490.             (prompt "Copying MagicWB icon files")
  491.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  492.             (dest "Thor:Docs")
  493.             (newname "THOR.guide.info")
  494.             (nogauge)
  495.         )
  496.         (copyfiles
  497.             (prompt "Copying MagicWB icon files")
  498.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  499.             (dest "Thor:Docs")
  500.             (newname "ConfigTHOR.guide.info")
  501.             (nogauge)
  502.         )
  503.         (copyfiles
  504.             (prompt "Copying MagicWB icon files")
  505.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  506.             (dest "Thor:Docs")
  507.             (newname "ARexx.guide.info")
  508.             (nogauge)
  509.         )
  510.         (copyfiles
  511.             (prompt "Copying MagicWB icon files")
  512.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  513.             (dest "Thor:Docs")
  514.             (newname "BBSReadRexx.guide.info")
  515.             (nogauge)
  516.         )
  517.         (copyfiles
  518.             (prompt "Copying MagicWB icon files")
  519.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  520.             (dest "Thor:Docs")
  521.             (newname "THOR_Rexx.guide.info")
  522.             (nogauge)
  523.         )
  524.         (copyfiles
  525.             (prompt "Copying MagicWB icon files")
  526.             (source "Thor_Install:MWBIcons/THOR.guide.info")
  527.             (dest "Thor:Docs")
  528.             (newname "Installation.guide.info")
  529.             (nogauge)
  530.         )
  531.     )
  532. )
  533.  
  534. (if (exists "env:sys/def_drawer.info" (noreq))
  535.     (copyfiles
  536.         (prompt "Copying default drawer icon")
  537.         (help "This will copy the default drawer icon." newline @copyfiles-help)
  538.         (source "env:sys/def_drawer.info")
  539.         (dest "Thor:")
  540.         (newname "Docs.info")
  541.         (infos)
  542.     )
  543. )
  544.  
  545. ;*****************************
  546. ;***** WE ARE ALMOST DONE ****
  547. ;*****************************
  548.  
  549. ; make sure that default-dir is pointing to the right place
  550. (set @default-dest Thor_Dir)
  551.     
  552. ; final message for our viewers
  553.     (set end_text (cat "Hope you like THOR! Don't hesitate to "
  554.                     "send us comments, bugreports and suggestions."))
  555.  
  556. (makeassign "Thor_Install")     
  557. (makeassign "Thor_Disk" (safe))
  558.  
  559. (if (= V3_Update yes)
  560.     (
  561.         (makeassign "BBSData")     
  562.     )
  563. )
  564.  
  565. ; now for the exit
  566.     (exit end_text)
  567.  
  568.